home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / print / isigns50.zip / ASK.PAS next >
Pascal/Delphi Source File  |  1989-10-01  |  16KB  |  447 lines

  1. PROCEDURE ask_t;    {f/sign format}
  2. VAR char_ans : CHAR;       {used for single char inut}
  3. BEGIN
  4.     WRITELN('One can change to type of sign to format the output horizontally');
  5.     WRITELN('across page (sign) or vertically down page (banner).  Do you want');
  6.     WRITE('a Sign or Banner? (S/B) -> ');
  7.     highvideo; char_ans := READKEY;
  8.     CASE char_ans OF
  9.         'B','b' : sign_type := banner;
  10.         'S','s' : sign_type := sign
  11.     END; {case}
  12.     disp_t;
  13.     avail_space
  14. END; {procedure ask_t}
  15.  
  16.  
  17. PROCEDURE ask_b;    {f/block type}
  18. VAR char_ans : CHAR;       {used for single char inut}
  19.      siz_ans : STRING[3];  {used for number input}
  20.      num,err : INTEGER;
  21. BEGIN
  22.     WRITELN('The graphic characters may be made of the letter of the character');
  23.     WRITELN('itself, two different type of blocks, or Graphic bits.  Do you want to print');
  24.     WRITE('Single-strike Blocks, Overstrike blocks, Letters, or Bits? (S/O/L/B) -> ');
  25.     highvideo; char_ans := READKEY;
  26.     CASE char_ans OF
  27.         'S','s' : BEGIN
  28.                       block_type := block;
  29.                       GOTORC(22,1); CLREOL; lowvideo;
  30.                       WRITE('Enter decimal number of character to use ->'); highvideo;
  31.                       READLN(siz_ans);
  32.                       IF siz_ans <> '' THEN BEGIN
  33.                           VAL(siz_ans,num,err);
  34.                           block_char := CHR(num)
  35.                       END
  36.                   END;
  37.         'L','l' : block_type := letter;
  38.         'O','o' : block_type := overstrike;
  39.         'B','b' : IF output_device <> printr THEN BEGIN
  40.                        WRITELN;
  41.                        WRITE('Bits aren''t available for this output device');
  42.                        sak
  43.                   END ELSE
  44.                        block_type := bit;
  45.     END; {case}
  46.     disp_b;
  47.     disp_d;
  48.     disp_p;
  49.     disp_l;
  50.     disp_v;
  51.     avail_space;
  52. END; {procedure_ask_b}
  53.  
  54.  
  55. PROCEDURE ask_f;    {f/font file}
  56. VAR strng_ans1,strng_ans2 : S14; {used for filename input}
  57.     ok : BOOLEAN;
  58. BEGIN
  59.     ok := TRUE;
  60.     WRITELN('The HP-LaserJet compatible soft font file and associated MkFntNfx-created');
  61.     WRITELN('index defines all characters.  The default extension for the HP font is .FNT');
  62.     WRITELN('and .FNX for the index.  The index filename must match the HP font filename');
  63.     WRITE('Enter FileName of HP Font File -> ');
  64.     highvideo; READLN(strng_ans1);
  65.     IF POS('.',strng_ans1) <> 0 THEN
  66.         strng_ans2 := COPY(strng_ans1,1,POS('.',strng_ans1)-1)
  67.     ELSE
  68.         strng_ans2 := strng_ans1;
  69.     init_ff(strng_ans1,strng_ans2,ok);
  70.     disp_fs;
  71.     disp_f
  72. END; {procedure ask_f}
  73.  
  74.  
  75. PROCEDURE ask_w;    {f/width multiplier}
  76. VAR            err : INTEGER;    {err code from strng-to-num convert}
  77.            siz_ans : STRING[3];  {used for number input}
  78. BEGIN
  79.     WRITELN('One can make the letters of the sign or banner bigger in width');
  80.     WRITELN('by entering a multiplier.  2 doubles size, 3 triples, etc.');
  81.     WRITE('Enter multiplier for width -> ');
  82.     highvideo; READLN(siz_ans);
  83.     IF siz_ans <> '' THEN VAL(siz_ans,mult_w,err);
  84.     disp_w
  85. END; {procedure ask_w}
  86.  
  87.  
  88. PROCEDURE ask_h;    {f/height multiplier}
  89. VAR            err : INTEGER;    {err code from strng-to-num convert}
  90.            siz_ans : STRING[3];  {used for number input}
  91. BEGIN
  92.     WRITELN('One can make the letters of the sign or banner bigger in height');
  93.     WRITELN('by entering a multiplier.  2 doubles size, 3 triples, etc.');
  94.     WRITE('Enter multiplier for height -> ');
  95.     highvideo; READLN(siz_ans);
  96.     IF siz_ans <> '' THEN VAL(siz_ans,mult_h,err);
  97.     disp_h
  98. END; {procedure ask_h}
  99.  
  100.  
  101. PROCEDURE ask_v;    {f/inverse video}
  102. VAR char_ans : CHAR;       {used for single char inut}
  103. BEGIN
  104.     WRITELN('This option reverses spaces to characters and vice-versa, effectively');
  105.     WRITELN('changing the output to reverse video.  The background is the defined single');
  106.     WRITE('block character.  Do you want Reverse Video output?  (Y/N) -> ');
  107.     highvideo; char_ans := READKEY;
  108.     CASE char_ans OF
  109.         'N','n' : inv_video := FALSE;
  110.         'Y','y' : inv_video := TRUE
  111.     END; {case}
  112.     disp_v
  113. END; {procedure ask_v}
  114.  
  115.  
  116. PROCEDURE ask_a;    {f/auto-centering}
  117. VAR char_ans : CHAR;       {used for single char inut}
  118. BEGIN
  119.     WRITELN('This option is active only if the given left margin is zero.');
  120.     WRITELN('Output can be centered within the maximum output width.');
  121.     WRITE('Should output be automatically centered?  (Y/N) -> ');
  122.     highvideo; char_ans := READKEY;
  123.     CASE char_ans OF
  124.         'N','n' : centering := FALSE;
  125.         'Y','y' : centering := TRUE
  126.     END; {case}
  127.     disp_a
  128. END; {procedure ask_a}
  129.  
  130.  
  131. PROCEDURE ask_m;    {f/given left margin}
  132. VAR            err : INTEGER;    {err code from strng-to-num convert}
  133.            siz_ans : STRING[3];  {used for number input}
  134. BEGIN
  135.     WRITELN('One can enter a given left margin to position banners and signs');
  136.     WRITELN('on the paper.  If the given left margin is zero, automatic centering');
  137.     WRITE('can also be done.  Enter number for left margin -> ');
  138.     highvideo; READLN(siz_ans);
  139.     IF siz_ans <> '' THEN BEGIN
  140.         VAL(siz_ans,given_offset,err);
  141.         centering := FALSE
  142.     END;
  143.     disp_a;
  144.     disp_m
  145. END; {procedure ask_m}
  146.  
  147.  
  148. PROCEDURE ask_g;    {f/given device size}
  149. VAR            err : INTEGER;    {err code from strng-to-num convert}
  150.            siz_ans : STRING[3];  {used for number input}
  151. BEGIN
  152.     WRITELN('If this option is non-zero it will override any of the other');
  153.     WRITELN('output size commands.  One can enter a defined output device');
  154.     WRITE('size (max=',Max_Length,') which will be used for checks and centering -> ');
  155.     highvideo; READLN(siz_ans);
  156.     IF siz_ans <> '' THEN VAL(siz_ans,given_width,err);
  157.     avail_space;
  158.     disp_g
  159. END; {procedure ask_g}
  160.  
  161.  
  162. PROCEDURE ask_q;    {f/abort exit}
  163. VAR ans : CHAR;
  164. BEGIN
  165.     WRITE('Do you want to abort ''SIGNS'' and quit?  (Y/N) -> '^G);
  166.     highvideo; ans := READKEY;
  167.     IF ans IN ['y','Y'] THEN BEGIN
  168.         GOTORC(24,1);
  169.         WRITELN('aborting SIGNS ...');
  170.         HALT
  171.     END
  172. END; {procedure ask_q}
  173.  
  174.  
  175. PROCEDURE ask_x(VAR all_ok,font_f_open,out_f_open : BOOLEAN;
  176.                 old_ff,old_of : S14);    {f/exiting to input}
  177. LABEL quick_exit;
  178. VAR err : INTEGER;   {for results of VAL procedure}
  179.     temp1,temp2 : s14; {temporary, for type conversion STRING[14] = S14}
  180. BEGIN
  181.     all_ok := TRUE;
  182.     temp1 := font_fn; temp2 := font_fni;
  183.     IF NOT ff_open OR (old_ff <> font_fn) THEN init_ff(temp1,temp2,all_ok);
  184.              {open font file if not open or if changed}
  185.     IF sign_type = Banner THEN BEGIN
  186.         space_needed := (ndx_array[0].height * mult_h) + given_offset;
  187.         IF space_needed > avail_width THEN BEGIN
  188.             GOTORC(24,1); WRITE('Warning: Banner is too tall to fit across the output page!'^G);
  189.             sak;
  190.         END
  191.     END ELSE
  192.         space_needed := given_offset;
  193.     GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  194.  
  195.     IF input_device = text_file THEN BEGIN     {open input file}
  196.         ASSIGN(in_file,in_fn);
  197.         {$I-} RESET(in_file); {$I+}
  198.         err := IORESULT;
  199.         IF err <> 0 THEN BEGIN
  200.             in_fn := '????';
  201.             GOTORC(24,1); highvideo;
  202.             WRITELN('ERR:',err,' opening Input file, check it!'^G);
  203.             sak;
  204.             all_ok := FALSE;
  205.             GOTO quick_exit
  206.         END {if bad open}
  207.     END; {if input from file}
  208.     IF out_f_open AND (output_device <> recd_file) THEN BEGIN
  209.             {if output is open and no needed, close old it}
  210.         {$I-} CLOSE(out_file); {$I+}             {close old file}
  211.         err := IORESULT;
  212.         IF err <> 0 THEN BEGIN
  213.             out_fn := '????';
  214.             GOTORC(24,1); highvideo;
  215.             WRITELN('ERR:',err,' closing output file, check it!'^G);
  216.             sak;
  217.             all_ok := FALSE;
  218.             GOTO quick_exit
  219.         END
  220.     END; {if no more file output}
  221.     IF output_device = recd_file THEN BEGIN
  222.         IF NOT out_f_